<?php
//用户注册控制器
class enrollController extends platformController{
	//载入视图文件
	public function displayAction(){
		require CURRENT_VIEW_PATH."user_enroll.html";
	}
	//判断用户输入的数据的方法
	public  function insertAction(){
		$model=new enrollModel();
		if(!empty($_POST)){
            if($_POST['username']=="" || $_POST['email']==""||$_POST['telephone']==""||$_POST['password']==""){
                echo "<script>alert('数据不能为空!');</script>";
            }
			if($model->username_check()){
                echo "<script>alert('该账户已存在!');</script>";
            }
			if($model->mail_check()){
                echo "<script>alert('该邮箱已存在!');</script>";
            } 
			if($model->telephone_check()){
                echo "<script>alert('该电话已存在!');</script>";
            }
        }
		if($model->insert()){
			$this->jump("index.php?p=home&c=news&a=list");
		}
	}
}
?>